<html>
  <head>
    <title>state简写</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/javascript" src="../../js/react.development.js"></script>
    <script type="text/javascript" src="../../js/react-dom.development.js"></script>
    <script type="text/javascript" src="../../js/babel.min.js"></script>
    <script type="text/babel">
      class Hello extends React.Component {
        state = { isJudith: true }

        changeName = () => {
          const { isJudith } = this.state;
          this.setState({ isJudith: !isJudith });
        }

        render() {
          const { isJudith } = this.state;
          return <h2 onClick={this.changeName}>你好: {isJudith ? 'Judith' : 'Zhang San'}</h2>;
        }
      }
      ReactDOM.render(<Hello />, document.getElementById('root'));
    </script>
  </body>
</html>
